//获取url中的参数
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg); //匹配目标参数
    if (r != null)
        return unescape(r[2]);
    return null; //返回参数值
}


//判断是编辑还是增加
var act = getUrlParam('act');
if (act == 'edit') {
    $('#main h2').text('编辑企业动态');
    $('#main form').attr('action', "/my/edit");
}
if(act =="add"){
    $('#main h2').text('增加企业动态');
    $('#main form').attr('action', '/my/add');
}
//点击关闭
$('#main>span').click(function () {
    $(window.parent.document).find('body').css({'overflow': 'auto'});
    $(window.parent.document).find("#news").attr('src', '').hide();
});
$('button').click(function(){
    $(window.parent.document).find("#vague").show();
    $(window.parent.document).find('body').css({'overflow': 'auto'});
    $(window.parent.document).find("#news").attr('src', '').hide();
})
//配置编辑器
var ue = UE.getEditor('container', {
    toolbars: [['fullscreen', 'source', '|', 'undo', 'redo', '|', 'bold', 'italic', 'underline', 'superscript', 'subscript', '|', 'forecolor', '|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright']], initialFrameWidth: 758, initialFrameHeight: 310, autoHeightEnabled: false});

//获取文章id
getUrlParam('id');